<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,IE=9,chrome=1"><meta name="generator" content="MATLAB 2021a"><title>Quadruple precision Flux Balance Analysis</title><style type="text/css">.rtcContent { padding: 30px; } .S0 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 28.8px; min-height: 0px; white-space: pre-wrap; color: rgb(213, 80, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 24px; font-weight: normal; text-align: left;  }
.S1 { margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;  }
.S2 { margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left;  }
.CodeBlock { background-color: #F7F7F7; margin: 10px 0 10px 0;}
.S3 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 0px none rgb(0, 0, 0); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S4 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 0px none rgb(0, 0, 0); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S5 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S6 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px 4px 0px 0px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S7 { color: rgb(64, 64, 64); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px;  }
/* Styling that is common to warnings and errors is in diagnosticOutput.css */.embeddedOutputsErrorElement {    min-height: 18px;    max-height: 250px;    overflow: auto;}
.embeddedOutputsErrorElement.inlineElement {}
.embeddedOutputsErrorElement.rightPaneElement {}
/* Styling that is common to warnings and errors is in diagnosticOutput.css */.embeddedOutputsWarningElement{    min-height: 18px;    max-height: 250px;    overflow: auto;}
.embeddedOutputsWarningElement.inlineElement {}
.embeddedOutputsWarningElement.rightPaneElement {}
/* Copyright 2015-2019 The MathWorks, Inc. *//* In this file, styles are not scoped to rtcContainer since they could be in the Dojo Tooltip */.diagnosticMessage-wrapper {    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;    font-size: 12px;}
.diagnosticMessage-wrapper.diagnosticMessage-warningType {    color: rgb(255,100,0);}
.diagnosticMessage-wrapper.diagnosticMessage-warningType a {    color: rgb(255,100,0);    text-decoration: underline;}
.diagnosticMessage-wrapper.diagnosticMessage-errorType {    color: rgb(230,0,0);}
.diagnosticMessage-wrapper.diagnosticMessage-errorType a {    color: rgb(230,0,0);    text-decoration: underline;}
.diagnosticMessage-wrapper .diagnosticMessage-messagePart,.diagnosticMessage-wrapper .diagnosticMessage-causePart {    white-space: pre-wrap;}
.diagnosticMessage-wrapper .diagnosticMessage-stackPart {    white-space: pre;}
.embeddedOutputsTextElement,.embeddedOutputsVariableStringElement {    white-space: pre;    word-wrap:  initial;    min-height: 18px;    max-height: 250px;    overflow: auto;}
.textElement,.rtcDataTipElement .textElement {    padding-top: 3px;}
.embeddedOutputsTextElement.inlineElement,.embeddedOutputsVariableStringElement.inlineElement {}
.inlineElement .textElement {}
.embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement {    min-height: 16px;}
.rightPaneElement .textElement {    padding-top: 2px;    padding-left: 9px;}
.S8 { margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left;  }
.embeddedOutputsMatrixElement,.eoOutputWrapper .matrixElement {    min-height: 18px;    box-sizing: border-box;}
.embeddedOutputsMatrixElement .matrixElement,.eoOutputWrapper  .matrixElement,.rtcDataTipElement .matrixElement {    position: relative;}
.matrixElement .variableValue,.rtcDataTipElement .matrixElement .variableValue {    white-space: pre;    display: inline-block;    vertical-align: top;    overflow: hidden;}
.embeddedOutputsMatrixElement.inlineElement {}
.embeddedOutputsMatrixElement.inlineElement .topHeaderWrapper {    display: none;}
.embeddedOutputsMatrixElement.inlineElement .veTable .body {    padding-top: 0 !important;    max-height: 100px;}
.inlineElement .matrixElement {    max-height: 300px;}
.embeddedOutputsMatrixElement.rightPaneElement {}
.rightPaneElement .matrixElement,.rtcDataTipElement .matrixElement {    overflow: hidden;    padding-left: 9px;}
.rightPaneElement .matrixElement {    margin-bottom: -1px;}
.embeddedOutputsMatrixElement .matrixElement .valueContainer,.eoOutputWrapper .matrixElement .valueContainer,.rtcDataTipElement .matrixElement .valueContainer {    white-space: nowrap;    margin-bottom: 3px;}
.embeddedOutputsMatrixElement .matrixElement .valueContainer .horizontalEllipsis.hide,.embeddedOutputsMatrixElement .matrixElement .verticalEllipsis.hide,.eoOutputWrapper .matrixElement .valueContainer .horizontalEllipsis.hide,.eoOutputWrapper .matrixElement .verticalEllipsis.hide,.rtcDataTipElement .matrixElement .valueContainer .horizontalEllipsis.hide,.rtcDataTipElement .matrixElement .verticalEllipsis.hide {    display: none;}
.embeddedOutputsVariableMatrixElement .matrixElement .valueContainer.hideEllipses .verticalEllipsis, .embeddedOutputsVariableMatrixElement .matrixElement .valueContainer.hideEllipses .horizontalEllipsis {    display:none;}
.embeddedOutputsMatrixElement .matrixElement .valueContainer .horizontalEllipsis,.eoOutputWrapper .matrixElement .valueContainer .horizontalEllipsis {    margin-bottom: -3px;}
.eoOutputWrapper .embeddedOutputsVariableMatrixElement .matrixElement .valueContainer {    cursor: default !important;}
.embeddedOutputsVariableElement {    white-space: pre-wrap;    word-wrap: break-word;    min-height: 18px;    max-height: 250px;    overflow: auto;}
.variableElement {}
.embeddedOutputsVariableElement.inlineElement {}
.inlineElement .variableElement {}
.embeddedOutputsVariableElement.rightPaneElement {    min-height: 16px;}
.rightPaneElement .variableElement {    padding-top: 2px;    padding-left: 9px;}
.variableNameElement {    margin-bottom: 3px;    display: inline-block;}
/* * Ellipses as base64 for HTML export. */.matrixElement .horizontalEllipsis,.rtcDataTipElement .matrixElement .horizontalEllipsis {    display: inline-block;    margin-top: 3px;    /* base64 encoded version of images-liveeditor/HEllipsis.png */    width: 30px;    height: 12px;    background-repeat: no-repeat;    background-image: url("");}
.matrixElement .verticalEllipsis,.textElement .verticalEllipsis,.rtcDataTipElement .matrixElement .verticalEllipsis,.rtcDataTipElement .textElement .verticalEllipsis {    margin-left: 35px;    /* base64 encoded version of images-liveeditor/VEllipsis.png */    width: 12px;    height: 30px;    background-repeat: no-repeat;    background-image: url("");}
.S9 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px 0px 4px 4px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }</style></head><body><div class = rtcContent><h1  class = 'S0' id = 'T_4CE2BBD0' ><span>Quadruple precision Flux Balance Analysis</span></h1><h2  class = 'S1' id = 'H_8C6952DD' ><span>Author(s): Ronan M.T. Fleming,, Leiden University</span></h2><h2  class = 'S1' id = 'H_13B2214D' ><span>Reviewer(s):</span></h2><h2  class = 'S1' id = 'H_BBAA3A65' ><span>INTRODUCTION</span></h2><div  class = 'S2'><span>In this tutorial, Flux Balance Analysis (FBA) is introduced using the E. coli core model, with functions in the COBRA Toolbox v3.0 [2].  </span></div><div  class = 'S2'><span>Flux balance analysis is a solution to the optimisation problem</span></div><div  class = 'S2'><span texencoding="
\begin{array}{ll}
\textrm{max} &amp; c^{T}v\\
\text{s.t.} &amp; Sv=b\\
 &amp; l\leq v\leq u
\end{array}
\end{equation}" style="vertical-align:-25px"><img src="" width="96.5" height="61" /></span></div><div  class = 'S2'><span>where </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">c</span><span> is a vector of linear objective coefficients, </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">S</span><span> is an m times n matrix of stoichiometric coefficients for m molecular species involved in n reactions. </span><span mathmlencoding="&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;l&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;and&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;u&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;" style="vertical-align:-5px"><img src="" width="45.5" height="18" /></span><span>are n times 1 vectors that are the lower and upper bounds on the n times 1 variable vector </span><span mathmlencoding="&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;v&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;" style="vertical-align:-5px"><img src="" width="12.5" height="18" /></span><span>of reaction rates (fluxes). The optimal objective value is </span><span texencoding="c^{T}v^{\star}" style="vertical-align:-5px"><img src="" width="30" height="19" /></span><span>  is always unique, but the optimal vector </span><span texencoding="v^{\star}" style="vertical-align:-5px"><img src="" width="16.5" height="19" /></span><span> is usually not unique.</span></div><div  class = 'S2'><span>In summary, the data is {c,S,l,u} and the variable being optimised is v.</span></div><h2  class = 'S1' id = 'H_4EC8492F' ><span>TIMING</span></h2><div  class = 'S2'><span style=' font-style: italic;'>&lt; 1 hrs</span></div><h2  class = 'S1' id = 'H_7E2A567B' ><span>MATERIALS - EQUIPMENT SETUP</span></h2><div  class = 'S2'><span>Please ensure that all the required dependencies (e.g. , </span><span style=' font-family: monospace;'>git</span><span> and </span><span style=' font-family: monospace;'>curl</span><span>) of The COBRA Toolbox have been properly installed by following the installation guide </span><a href = "https://opencobra.github.io/cobratoolbox/stable/installation.html"><span>here</span></a><span>. Please ensure that the COBRA Toolbox has been initialised (tutorial_initialize.mlx) and verify that the pre-packaged LP and QP solvers are functional (tutorial_verify.mlx).</span></div><h2  class = 'S1' id = 'H_B642E8E4' ><span>PROCEDURE</span></h2><h2  class = 'S1' id = 'H_ED106D18' ><span>Load a multiscale model</span></h2><div  class = 'S2'><span>To load a model from a MAT-file, you can simply use the filename (with or without file extension). </span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S3'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >~exist(</span><span style="color: rgb(170, 4, 249);">'model'</span><span >,</span><span style="color: rgb(170, 4, 249);">'var'</span><span >)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    load </span><span style="color: rgb(170, 4, 249);">ME_matrix_GlcAer_WT.mat</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    model = modelGlcOAer_WT;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    clear </span><span style="color: rgb(170, 4, 249);">modelGlcOAer_WT</span><span >;</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><h2  class = 'S1'><span style=' font-style: italic;'>Check the scaling properties of a stoichiometric matrix</span></h2><div  class = 'S2'><span>The scaling properties of the stoichiometric matrix using:</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >[precisionEstimate, solverRecommendation] = checkScaling(model);</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement scrollableOutput" uid="20D10E66" data-testid="output_0" data-width="428" data-height="633" data-hashorizontaloverflow="true" style="width: 458px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"> ------------------------ Scaling summary report ------------------------

 Estimation level:                             fine (scltol = 1.00)
 Name of matrix:                               S
 Size of matrix:
        * metabolites:                         68298
        * reactions:                           76664
 Stoichiometric coefficients:
        * Minimum (absolute non-zero value):   5.50e-05
        * Maximum (absolute non-zero value):   8.01e+05
 Lower bound coefficients:
        * Minimum (absolute non-zero value):   1.00e+06
        * Maximum (absolute non-zero value):   1.00e+09
 Upper bound coefficients:
        * Minimum (absolute non-zero value):   5.54e+00
        * Maximum (absolute non-zero value):   1.00e+09
 Row scaling coefficients:
        * Minimum:                             1.67e-03 (row #: 24548)
        * Maximum:                             7.90e+04 (row #: 66206)
 Column scaling coefficients:
        * Minimum:                             3.47e-04 (column #: 130)
        * Maximum:                             1.13e+04 (column #: 24943)

 ---------------------------------- Ratios --------------------------------

 Ratio of stoichiometric coefficients:         1.46e+10
 Order of magnitude diff. (stoich. coeff.):    10

 Ratio of lower bounds:                        1.00e+03
 Order of magnitude diff. (lower bounds):      3

 Ratio of upper bounds:                        1.80e+08
 Order of magnitude diff. (upper bounds):      8

 Ratio of row scaling coefficients:            4.72e+07
 Order of magnitude diff. (row scaling):       7

 Ratio of column scaling coefficients:         3.27e+07
 Order of magnitude diff. (column scaling):    7

 --------------------------------------------------------------------------

 -&gt; The model has badly scaled rows and columns. Quad precision is strongly recommended.

    Set the Quad MINOS solver with: &gt;&gt; changeCobraSolver('quadMinos', 'LP')</div></div></div></div></div><div  class = 'S8'><span>If </span><span style=' font-family: monospace;'>precisionEstimate=='quad'</span><span> then the "model has badly scaled rows and colums" then a quad precision solver is required. </span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >precisionEstimate</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="9C80F58B" data-testid="output_1" data-width="428" data-height="20" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">precisionEstimate = </span>'quad'</div></div></div></div></div></div><div  class = 'S8'><span>Quad precision solvers come installed by default in COBRA Toolbox v3 so solverRecommendation should include  {'dqqMinos'} and   {'quadMinos'}</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >solverRecommendation</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextMatrixElement embeddedOutputsVariableMatrixElement" uid="E838AB56" data-testid="output_2" data-width="428" style="width: 458px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="matrixElement veSpecifier saveLoad" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="veVariableName variableNameElement" style="width: 428px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="headerElementClickToInteract" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">solverRecommendation = </span><span class="veVariableValueSummary headerElement" style="white-space: normal; font-style: normal; color: rgb(179, 179, 179); font-size: 12px;">1×2 cell</span></div></div><div class="valueContainer" data-layout="{&quot;totalRows&quot;:&quot;1&quot;,&quot;totalColumns&quot;:&quot;2&quot;}" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="variableValue" style="width: 195px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">'dqqMinos'    'quadMinos'    <br></div><div class="horizontalEllipsis hide" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"></div><div class="verticalEllipsis hide" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"></div></div></div></div></div></div></div><div  class = 'S8'><span>Change to a solution approach that combines double and quad precision to try to solve the LP problem.  If they are properly installed then </span><span style=' font-family: monospace;'>solverOK == 1</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S6'><span style="white-space: pre"><span >[solverOK, solverInstalled] = changeCobraSolver(</span><span style="color: rgb(170, 4, 249);">'dqqMinos'</span><span >,</span><span style="color: rgb(170, 4, 249);">'LP'</span><span >)</span></span></div><div  class = 'S7'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="66290106" data-testid="output_3" data-width="428" data-height="18" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"> &gt; Solver dqqMinos is installed but not working properly.</div></div><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="399097A1" data-testid="output_4" data-width="428" data-height="34" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">solverOK = <span class="headerElement" style="white-space: pre; font-style: italic; color: rgb(179, 179, 179); font-size: 12px;">logical</span></span></div><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">   0
</div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="838347C5" data-testid="output_5" data-width="428" data-height="34" data-hashorizontaloverflow="false" style="width: 458px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">solverInstalled = <span class="headerElement" style="white-space: pre; font-style: italic; color: rgb(179, 179, 179); font-size: 12px;">logical</span></span></div><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">   1
</div></div></div></div></div><div class="inlineWrapper"><div  class = 'S9'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%[solverOK, solverInstalled] = changeCobraSolver('quadMinos','LP')</span></span></div></div></div><div  class = 'S8'><span>Further information on numerical characterisation of COBRA models can be found in </span><span style=' font-family: monospace;'>tutorial_numCharact.mlx</span></div><h2  class = 'S1'><span>Solve a quad FBA problem</span></h2><div  class = 'S2'><span>Solve a FBA problem in quad precision using </span><span style=' font-family: monospace;'>optimizeCbModel</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S3'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >solverOK</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    FBAsolution = optimizeCbModel(model,</span><span style="color: rgb(170, 4, 249);">'max'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><h2  class = 'S1'><span>TROUBLESHOOTING</span></h2><div  class = 'S2'><span>Always check the value of </span><span style=' font-family: monospace;'>solution.stat</span><span>, which returns the status of the solution, even when using quad precision.</span></div><div  class = 'S2'><span style=' font-family: monospace;'>solution.stat == 1 </span><span> means the FBA problem is solved successfully. Anything else and there is a problem.</span></div><div  class = 'S2'><span>Although it does not happen often, there are many reasons why an FBA problem might not solve, so they are divided into three categories. </span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S3'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%      solution.stat - Solver status in standardized form:</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%                      * `-1` - No solution reported (timelimit, numerical problem etc)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%                      * `1` - Optimal solution</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%                      * `2` - Unbounded solution</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%                      * `0` - Infeasible</span></span></div></div></div><div  class = 'S8'><span style=' font-family: monospace;'>solution.stat == 0</span><span>  means that the problem is overconstrainted and no feasible flux vector v exists. The constraints need to be relaxed before the problem will solve. See tutorial_relaxedFBA.mlx</span></div><div  class = 'S2'><span style=' font-family: monospace;'>solution.stat = 2</span><span>  means that the problem is underconstrained to the extent that the possible optimal value of the objective is unbounded, that is infinity, or minus infinity. This means that extra constraints need to be added, e.g., lower and upper bounds on the reaction rates.</span></div><div  class = 'S2'><span style=' font-family: monospace;'>solution.stat = 1</span><span>  means that the problem is more complicated than either of the above. It could be that the problem does, in principle, have a solution, but that the current solver cannot find one, so an industrial quality solver should be tested, e.g., gurobi. It could also mean that the FBA problem is poorly scaled so there are numerical problems solving it, or it could also be just slightly infeasible, in which case a higher precision solver will be required to solve the problem, e.g., a quadruple precision solver. The way each solver reports the nature of the problem varies between solvers, so checking </span><span style=' font-family: monospace;'>solution.origStat</span><span> against the documentation that comes with each solver is necessary to figure out what the potential solution is.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S3'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%    solution.stat - Solver status in standardized form:</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%                      * `-1` - No solution reported (timelimit, numerical problem etc)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%                      * `1` - Optimal solution</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%                      * `2` - Unbounded solution</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%                      * `0` - Infeasible</span></span></div></div></div><h2  class = 'S1' id = 'H_878295C9' ><span style=' font-style: italic;'>Acknowledgments</span></h2><div  class = 'S2'><span style=' font-style: italic;'>Prof. Michael A. Saunders at Stanford University is responsible for the quad precision solvers that are included in the COBRA toolbox.</span></div><h2  class = 'S1' id = 'H_B884F0F4' ><span>REFERENCES</span></h2><div  class = 'S2'><span>[1] P. E. Gill, W. Murray, M. A. Saunders and M. H. Wright (1987). Maintaining LU factors of a general sparse matrix, Linear Algebra and its Applications 88/89, 239-270.</span></div><div  class = 'S2'><span>[2] Multiscale modeling of metabolism and macromolecular synthesis in E. coli and its application to the evolution of codon usage, Thiele et al., PLoS One, 7(9):e45635 (2012).</span></div><div  class = 'S2'><span>[3] D. Ma, L. Yang, R. M. T. Fleming, I. Thiele, B. O. Palsson and M. A. Saunders, Reliable and efficient solution of genome-scale models of Metabolism and macromolecular Expression, Scientific Reports 7, 40863; doi: \url{10.1038/srep40863} (2017). </span><a href = "http://rdcu.be/oCpn."><span>http://rdcu.be/oCpn.</span></a></div><div  class = 'S2'><span>[4]. Laurent Heirendt &amp; Sylvain Arreckx, Thomas Pfau, Sebastian N. Mendoza, Anne Richelle, Almut Heinken, Hulda S. Haraldsdottir, Jacek Wachowiak, Sarah M. Keating, Vanja Vlasov, Stefania Magnusdottir, Chiam Yu Ng, German Preciat, Alise Zagare, Siu H.J. Chan, Maike K. Aurich, Catherine M. Clancy, Jennifer Modamio, John T. Sauls, Alberto Noronha, Aarash Bordbar, Benjamin Cousins, Diana C. El Assal, Luis V. Valcarcel, Inigo Apaolaza, Susan Ghaderi, Masoud Ahookhosh, Marouen Ben Guebila, Andrejs Kostromins, Nicolas Sompairac, Hoai M. Le, Ding Ma, Yuekai Sun, Lin Wang, James T. Yurkovich, Miguel A.P. Oliveira, Phan T. Vuong, Lemmer P. El Assal, Inna Kuperstein, Andrei Zinovyev, H. Scott Hinton, William A. Bryant, Francisco J. Aragon Artacho, Francisco J. Planes, Egils Stalidzans, Alejandro Maass, Santosh Vempala, Michael Hucka, Michael A. Saunders, Costas D. Maranas, Nathan E. Lewis, Thomas Sauter, Bernhard Ø. Palsson, Ines Thiele, Ronan M.T. Fleming, </span><span style=' font-weight: bold;'>Creation and analysis of biochemical constraint-based models: the COBRA Toolbox v3.0</span><span>, Nature Protocols, volume 14, pages 639–702, 2019 </span><a href = "https://doi.org/10.1038/s41596-018-0098-2"><span>doi.org/10.1038/s41596-018-0098-2</span></a><span>.</span></div><div  class = 'S2'></div>
<br>
<!-- 
##### SOURCE BEGIN #####
%% Quadruple precision Flux Balance Analysis
%% Author(s): Ronan M.T. Fleming,, Leiden University
%% Reviewer(s):
%% INTRODUCTION
% In this tutorial, Flux Balance Analysis (FBA) is introduced using the E. coli 
% core model, with functions in the COBRA Toolbox v3.0 [2].  
% 
% Flux balance analysis is a solution to the optimisation problem
% 
% $$\begin{array}{ll}\textrm{max} & c^{T}v\\\text{s.t.} & Sv=b\\ & l\leq v\leq 
% u\end{array}\end{equation}$$
% 
% where $c$ is a vector of linear objective coefficients, $S$ is an m times 
% n matrix of stoichiometric coefficients for m molecular species involved in 
% n reactions. $l\;\textrm{and}\;u\;$are n times 1 vectors that are the lower 
% and upper bounds on the n times 1 variable vector $v\;$of reaction rates (fluxes). 
% The optimal objective value is $c^{T}v^{\star}$  is always unique, but the optimal 
% vector $v^{\star}$ is usually not unique.
% 
% In summary, the data is {c,S,l,u} and the variable being optimised is v.
%% TIMING
% _< 1 hrs_
%% MATERIALS - EQUIPMENT SETUP
% Please ensure that all the required dependencies (e.g. , |git| and |curl|) 
% of The COBRA Toolbox have been properly installed by following the installation 
% guide <https://opencobra.github.io/cobratoolbox/stable/installation.html here>. 
% Please ensure that the COBRA Toolbox has been initialised (tutorial_initialize.mlx) 
% and verify that the pre-packaged LP and QP solvers are functional (tutorial_verify.mlx).
%% PROCEDURE
%% Load a multiscale model
% To load a model from a MAT-file, you can simply use the filename (with or 
% without file extension). 

if ~exist('model','var')
    load ME_matrix_GlcAer_WT.mat
    model = modelGlcOAer_WT;
    clear modelGlcOAer_WT;
end
%% _Check the scaling properties of a stoichiometric matrix_
% The scaling properties of the stoichiometric matrix using:

[precisionEstimate, solverRecommendation] = checkScaling(model);
%% 
% If |precisionEstimate=='quad'| then the "model has badly scaled rows and colums" 
% then a quad precision solver is required. 

precisionEstimate
%% 
% Quad precision solvers come installed by default in COBRA Toolbox v3 so solverRecommendation 
% should include  {'dqqMinos'} and   {'quadMinos'}

solverRecommendation
%% 
% Change to a solution approach that combines double and quad precision to try 
% to solve the LP problem.  If they are properly installed then |solverOK == 1|

[solverOK, solverInstalled] = changeCobraSolver('dqqMinos','LP')
%[solverOK, solverInstalled] = changeCobraSolver('quadMinos','LP')
%% 
% Further information on numerical characterisation of COBRA models can be found 
% in |tutorial_numCharact.mlx|
%% Solve a quad FBA problem
% Solve a FBA problem in quad precision using |optimizeCbModel|

if solverOK
    FBAsolution = optimizeCbModel(model,'max');
end
%% TROUBLESHOOTING
% Always check the value of |solution.stat|, which returns the status of the 
% solution, even when using quad precision.
% 
% |solution.stat == 1|  means the FBA problem is solved successfully. Anything 
% else and there is a problem.
% 
% Although it does not happen often, there are many reasons why an FBA problem 
% might not solve, so they are divided into three categories. 

%      solution.stat - Solver status in standardized form:
%                      * `-1` - No solution reported (timelimit, numerical problem etc)
%                      * `1` - Optimal solution
%                      * `2` - Unbounded solution
%                      * `0` - Infeasible
%% 
% |solution.stat == 0|  means that the problem is overconstrainted and no feasible 
% flux vector v exists. The constraints need to be relaxed before the problem 
% will solve. See tutorial_relaxedFBA.mlx
% 
% |solution.stat = 2|  means that the problem is underconstrained to the extent 
% that the possible optimal value of the objective is unbounded, that is infinity, 
% or minus infinity. This means that extra constraints need to be added, e.g., 
% lower and upper bounds on the reaction rates.
% 
% |solution.stat = 1|  means that the problem is more complicated than either 
% of the above. It could be that the problem does, in principle, have a solution, 
% but that the current solver cannot find one, so an industrial quality solver 
% should be tested, e.g., gurobi. It could also mean that the FBA problem is poorly 
% scaled so there are numerical problems solving it, or it could also be just 
% slightly infeasible, in which case a higher precision solver will be required 
% to solve the problem, e.g., a quadruple precision solver. The way each solver 
% reports the nature of the problem varies between solvers, so checking |solution.origStat| 
% against the documentation that comes with each solver is necessary to figure 
% out what the potential solution is.

%    solution.stat - Solver status in standardized form:
%                      * `-1` - No solution reported (timelimit, numerical problem etc)
%                      * `1` - Optimal solution
%                      * `2` - Unbounded solution
%                      * `0` - Infeasible
%% _Acknowledgments_
% _Prof. Michael A. Saunders at Stanford University is responsible for the quad 
% precision solvers that are included in the COBRA toolbox._
%% REFERENCES
% [1] P. E. Gill, W. Murray, M. A. Saunders and M. H. Wright (1987). Maintaining 
% LU factors of a general sparse matrix, Linear Algebra and its Applications 88/89, 
% 239-270.
% 
% [2] Multiscale modeling of metabolism and macromolecular synthesis in E. coli 
% and its application to the evolution of codon usage, Thiele et al., PLoS One, 
% 7(9):e45635 (2012).
% 
% [3] D. Ma, L. Yang, R. M. T. Fleming, I. Thiele, B. O. Palsson and M. A. Saunders, 
% Reliable and efficient solution of genome-scale models of Metabolism and macromolecular 
% Expression, Scientific Reports 7, 40863; doi: \url{10.1038/srep40863} (2017). 
% <http://rdcu.be/oCpn. http://rdcu.be/oCpn.>
% 
% [4]. Laurent Heirendt & Sylvain Arreckx, Thomas Pfau, Sebastian N. Mendoza, 
% Anne Richelle, Almut Heinken, Hulda S. Haraldsdottir, Jacek Wachowiak, Sarah 
% M. Keating, Vanja Vlasov, Stefania Magnusdottir, Chiam Yu Ng, German Preciat, 
% Alise Zagare, Siu H.J. Chan, Maike K. Aurich, Catherine M. Clancy, Jennifer 
% Modamio, John T. Sauls, Alberto Noronha, Aarash Bordbar, Benjamin Cousins, Diana 
% C. El Assal, Luis V. Valcarcel, Inigo Apaolaza, Susan Ghaderi, Masoud Ahookhosh, 
% Marouen Ben Guebila, Andrejs Kostromins, Nicolas Sompairac, Hoai M. Le, Ding 
% Ma, Yuekai Sun, Lin Wang, James T. Yurkovich, Miguel A.P. Oliveira, Phan T. 
% Vuong, Lemmer P. El Assal, Inna Kuperstein, Andrei Zinovyev, H. Scott Hinton, 
% William A. Bryant, Francisco J. Aragon Artacho, Francisco J. Planes, Egils Stalidzans, 
% Alejandro Maass, Santosh Vempala, Michael Hucka, Michael A. Saunders, Costas 
% D. Maranas, Nathan E. Lewis, Thomas Sauter, Bernhard Ø. Palsson, Ines Thiele, 
% Ronan M.T. Fleming, *Creation and analysis of biochemical constraint-based models: 
% the COBRA Toolbox v3.0*, Nature Protocols, volume 14, pages 639–702, 2019 <https://doi.org/10.1038/s41596-018-0098-2 
% doi.org/10.1038/s41596-018-0098-2>.
% 
%
##### SOURCE END #####
-->
</div></body></html>